<!DOCTYPE html>
<html>

<head>
  <title>Search</title>
	<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">

  <!-- Core CSS -->
	<link href="{{ url_for('static', filename='css/bootstrap4.min.css') }}" rel="stylesheet">
	<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet">
	<link href="{{ url_for('static', filename='css/dataTables.bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/ail-project.css') }}" rel="stylesheet">

  <!-- JS -->
	<script src="{{ url_for('static', filename='js/jquery.js')}}"></script>
	<script src="{{ url_for('static', filename='js/popper.min.js')}}"></script>
	<script src="{{ url_for('static', filename='js/bootstrap4.min.js')}}"></script>
	<script src="{{ url_for('static', filename='js/jquery.dataTables.min.js')}}"></script>
	<script src="{{ url_for('static', filename='js/dataTables.bootstrap.min.js')}}"></script>
    <script src="{{ url_for('static', filename='js/helper.js')}}"></script>

</head>
<body>

	{% include 'nav_bar.html' %}

	<div class="container-fluid">
		<div class="row">

			{% include 'sidebars/sidebar_search.html' %}

			<div class="col-12 col-lg-10" id="core_content">

                {% include 'search/block_chats_search.html' %}

                {% include 'objects/image/block_blur_img_slider.html' %}

                {% if result %}
                    {% set endpoint_url = url_for('search_b.search_chats') + "?search=" + to_search + "&index=" + search_index %}
                    {% include 'search/pagination.html' %}
                {% endif %}

                {% for obj in result %}

                    {% with message=obj %}
                        {% include 'chats_explorer/block_message.html' %}
                    {% endwith %}

{#                    <div class="card mb-2">#}
{#                        <div class="card-header bg-dark">#}
    {#                        TODO URL   #}
{#                            <h5 class="text-white text-center">{{ obj['full_date'] }} &nbsp; <small><a target="_blank" href="{{ url_for('objects_item.showItem') }}?id={{ obj['id'] }}">{{ obj['id'] }}</a></small></h5>#}
{#                        </div>#}
{#                        <div class="card-body py-1">#}
{#                            <div>#}
{#                                <h5>#}
{#                                    {% for tag in obj['tags'] %}#}
{#                                        <span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }}">{{ tag }}</span>#}
{#                                    {% endfor %}#}
{#                                </h5>#}
{#                            </div>#}
{##}
{#                            <pre class="border">{% for c in obj['result'] %}{% if loop.index0 % 2 %}<span class="hg-text">{{ c }}</span>{% else %}{{ c }}{% endif %}{% endfor %}</pre>#}
{#                            <pre class="border">{{ obj['result'] }}</pre>#}
{##}
{#                        </div>#}
{#                    </div>#}

                {% endfor %}

                {% if result %}
                    {% include 'search/pagination.html' %}
                    <br>
		            <br>
                {% endif %}

            </div>

        </div>
    </div>

<script>
    $(document).ready(function(){
        $("#page-search").addClass("active");
        $("#nav_explorer_chat").addClass("active");
  });

function toggle_sidebar(){
	if($('#nav_menu').is(':visible')){
		$('#nav_menu').hide();
		$('#side_menu').removeClass('border-right')
		$('#side_menu').removeClass('col-lg-2')
		$('#core_content').removeClass('col-lg-10')
	}else{
		$('#nav_menu').show();
		$('#side_menu').addClass('border-right')
		$('#side_menu').addClass('col-lg-2')
		$('#core_content').addClass('col-lg-10')
	}
}
</script>

</body>

</html>
